<?php

require_once 'Zend/View/Helper/Abstract.php';


class Zend_View_Helper_ComUrl extends Zend_View_Helper_Abstract
{
    
    public function comUrl($c = null,$a = null,$urlOptions = array(), $name = null, $reset = false, $encode = true)
    {
        $fc = Zend_Controller_Front::getInstance();
    	$router = $fc->getRouter();	
					
		if(null !== $c){
			$urlOptions['controller'] = $c;	
		}
		if(null !== $a){
			$urlOptions['action'] = $a;
		}
		if(!isset($urlOptions['lan']) or empty($urlOptions['lan'])){			
			$urlOptions['lan'] = $this->view->lang;
		}
		if(!isset($urlOptions['uid']) or empty($urlOptions['uid'])){			
			$urlOptions['uid'] = $this->view->uid;
		}
		if(!isset($urlOptions['module']) or empty($urlOptions['module'])){			
			$urlOptions['module'] = 'com';
		}
		
        return $router->assemble($urlOptions, $name, true, $encode);
    }
}
